﻿#include "UserEntity.h"
#include <QJsonDocument>
#include <QUuid>
#include <SqliteDatabase.h>

UserEntity::UserEntity():
    mId(QUuid::createUuid().toString())
    ,mWorkID("default")
{

}
QVariant UserEntity::toVariant() const
{
    QVariantMap map;
    map.insert("id",mId);
    map.insert(WORKERID, mWorkID);
    map.insert("data", mData);
    return map;
}

void UserEntity::fromVariant(const QVariant &variant)
{
    QVariantMap map = variant.toMap();
    mId = map.value("id").toString();
    mWorkID = map.value(WORKERID).toString();
    mData = map.value("data").toJsonObject();
}
